home *** CD-ROM | disk | FTP | other *** search
- .Na "bcp_control"
- .mc |
- .Aa
- .Fu
- Change various control parameter default settings.
- .Ih "bcp, set control parameters"
- .Sy
- .Sf "RETCODE bcp_control(dbproc, field, value)"
- .Sp "DBPROCESS" "*dbproc"
- .Sp "int" "field"
- .Sp "DBINT" "value"
- .Co
- .Bl
- This function sets various control parameters for bulk copy
- operations, including the number of errors allowed before aborting
- a bulk copy, the numbers of the first and last rows to copy, and the
- batch size.
- .Bl
- These control parameters are only meaningful when copying between a host file
- and a \*S table.
- Control parameter settings have no effect on \f2bcp_bind()\f1 row transfers.
- .Bl
- The following program fragment illustrates \f2bcp_control()\f1:
- .SD
- .ta +4n +4n +4n +4n +4n +4n +4n
- LOGINREC *login;
- DBPROCESS *dbproc;
- DBINT rowsread;
-
- /* Initialize DB-Library. */
- if (dbinit() == FAIL)
- exit(ERREXIT);
-
- /* Install error-handler and message-handler. */
- dberrhandle(err_handler);
- dbmsghandle(msg_handler);
-
- /* Open a DBPROCESS. */
- login = dblogin();
- BCP_SETL(login, TRUE);
- dbproc = dbopen(login, NULL);
-
- /* Initialize bcp. */
- if (bcp_init(dbproc, "comdb..address", "address.add", "addr.error", DB_IN) == FAIL)
- exit(ERREXIT);
-
- /* Set the number of rows per batch. */
- if (bcp_control(dbproc, BCPBATCH, 1000) == FAIL)
- {
- printf("bcp_control failed to set batching behavior.\en");
- exit(ERREXIT);
- }
-
- /* Set host column count. */
- if (bcp_columns(dbproc, 1) == FAIL)
- {
- printf("bcp_columns failed.\en");
- exit(ERREXIT);
- }
-
- /* Set the host-file format. */
- if (bcp_colfmt(dbproc, 1, 0, 0, -1, (BYTE *)("\en"), 1, 1) == FAIL)
- {
- printf("bcp_colformat failed.\en");
- exit(ERREXIT);
- }
-
- /* Now, execute the bulk copy. */
- if (bcp_exec(dbproc, &rowsread) == FAIL)
- {
- printf("Incomplete bulk copy. Only %ld row%c copied.\en",
- rowsread, (rowsread == 1) ? ' ': 's');
-
- exit(ERREXIT);
- }
- .ED
- .Bl
- For information on the \f2bcp\f1 utility program, see its manual page
- in the \f2Commands Reference\f1.
- .Bz
- .Pa
- .Pi dbproc
- A pointer to the DBPROCESS structure that provides the connection
- for a particular front-end/\*S process. It contains all the
- information that \*L uses to manage communications and data between the
- front end and \*S.
- .Pi field
- The \f2field\f1 can be one of the following:
- .in +3n
- .sp 0.5v
- .nf
- .ta +1.4i
- \f3Field\f1 \f3Description\f1
- .sp 0.5v
- BCPMAXERRS The number of errors allowed before giving up. The
- default is 10.
-
- BCPFIRST The first row to copy. The default is 1. A value of
- less than 1 resets this field to its default value of 1.
-
- BCPLAST The last row to copy. The default is to copy all rows.
- A value less than 1 resets this field to its default value.
-
- BCPBATCH The number of rows per batch. The default is 0, which
- means that the entire bulk copy will be done in one
- batch. This field is only meaningful when copying from
- a host file into \*S.
- .fi
- .sp 0.5v
- .in -3n
- .Pi value
- The value for the specified \f2field\f1.
- .in -.375i
- .Re
- .br
- SUCCEED or FAIL.
- .Sa
- bcp_batch,
- bcp_bind,
- bcp_colfmt,
- bcp_collen,
- bcp_colptr,
- bcp_columns,
- bcp_done,
- bcp_exec,
- bcp_init
- .mc
-